<template>
	<view class="">
		<navbar :title="i18n.yqhy"></navbar>
		<view class="px20 auto bor10 mt20 pb40 por">
			<view class="por">
				<image src="../../static/uesr/share.png" class="share0" mode="aspectFill"></image>
				<view class="poa visitbox">
					<view class="color-white text--center f28 letter1 yqtitle">{{i18n.yqhyz}}</view>
					<view class="mt10 mx12 px15 py13 fcc codebox">
						<view class="code por px4 py4">
							<tkiQrcod cid="qrcode" ref="qrcode" :val="inviteLink" onval :size="164" loadMake :showLoading="false" @result="result" class="ewm" />
						</view>
						<view class="ml14 f15 color-white ">
							<view class="fcc">
								<image src="../../static/uesr/share2.png" class="block40"></image>
								<text class="ml6">{{i18n.wlsk}}</text>
							</view>
							<view class="mt5">
								<text>{{i18n.yqm}}：</text>
								<text class="f20 fwb color-yellow">{{userInfo.inviteCode}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="mt15 fsb f16 text--center">
				<view class="copybtn" @click="copy(userInfo.inviteCode)">{{i18n.fzyqm}}</view>
				<view class="copybtn" @click="copy(inviteLink)">{{i18n.fzlj}}</view>
			</view>
		</view>
	</view>
</template>

<script>
import { mapState, mapActions } from 'vuex';
import tkiQrcod from '@/components/tki-qrcode/tki-qrcode.vue';
import share from '@/mixins/share';
export default {
	mixins: [share],
	components: { tkiQrcod },
	data() {
		return {
			qrcode: '1',
			area: true,
			inviteLink:''
		};
	},
	computed: {
		i18n() {
			return this.$t('user');
		}
	},
	onLoad() {
		this.getVersion()
	},
	onShow(){
		
		// this.getUser()
	},
	methods: {
		result(e) {
			this.qrImg = e;
		},
		async getVersion(){
			let symstemName = ''
			// #ifdef APP-PLUS
			symstemName = plus.os.name
			symstemName = symstemName=='iOS'?system.toUpperCase():symstemName
			// #endif
			// #ifdef H5
			symstemName = 'Android'
			// #endif
			let {data} = await this.$http.post('login.getAppVersion', {system:symstemName}, { isAuth: false,tipConfig: { isLoading: false } })
			console.log(data)
			this.inviteLink = data.url
			// let that = this
			// console.log(this.inviteLink)
			// that.$refs.qrcode._clearCode()
			// setTimeout(function(){
			// 	that.$refs.qrcode._makeCode()
			// },500)
		}
	}
};
</script>

<style lang="less">
	.share0{
		width: 100%;
		height: 1080rpx;
	}
	.yqtitle{
		text-shadow:0 0 40px #2100ff;
	}
	.visitbox{
		width: 100%;
		bottom: 20rpx;
		left:0;
		z-index: 10;
	}
	.codebox{
		background-color: #003b7e; 
	}
	.copybtn{
		width: 310rpx;
		height: 90rpx;
		color: #fff;
		line-height: 94rpx;
		background:#007AFF;
		border-radius: 10rpx;
	}
	.title {
		display: block;
		width: 354rpx;
		height: 64rpx;
		margin: 0 auto;
		padding-top: 92rpx;
	}
.code {
	background: white;
	border-radius: 16rpx;
	.ewm {
		width: 164rpx;
		height: 164rpx;
	}
}
</style>
